home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-serious-
/
programming
/
other
/
gui4cli
/
g4c
/
ced
/
cedclip.g
< prev
next >
Wrap
Text File
|
1999-05-14
|
4KB
|
157 lines
G4C
; CedClip.g - clipboard viewer
; --------------------------------------------------------
WINBIG 143 21 407 190 'Clipboard Viewer'
WinType 11110001
xOnLoad
setgad cedclip.g 11 hide ; hide 2nd lv
BOX 0 0 407 25 in ICONDROP
; --------------------------------------------------------
; Change the clipboard unit
; --------------------------------------------------------
xIcon 292 6 :icons/left
--cedbar.gc/cedClip
gosub CedClip.g changeunit
xIcon 366 6 :icons/right
++cedbar.gc/cedClip
gosub CedClip.g changeunit
XTEXTIN 309 5 53 14 "" unit '0' 10
gadid 2
gosub CedClip.g changeunit
xRoutine ChangeUnit
; make sure the cedbar.gc/cedClip is 0-255
if $cedbar.gc/cedClip > 255
cedbar.gc/cedClip = 0
elseif $cedbar.gc/cedClip < 0
cedbar.gc/cedClip = 255
endif
; load the given clip..
lvuse CedClip.g 1
lvchange "CLIPS:$cedbar.gc/cedClip"
; update the text gad
update CedClip.g 2 $cedbar.gc/cedClip
; and update cedbar.gc also..
update cedbar.gc 1 $cedbar.gc/cedClip
cedbar.gc/cedSend = "set clipboard unit "
AppVar cedbar.gc/cedSend $cedbar.gc/cedClip
SendRexx $cedbar.gc/cedport $cedbar.gc/cedSend
; --------------------------------------------------------
; Load a file into the current clipboard unit
; --------------------------------------------------------
xIcon 10 5 :icons/Open
ReqFile -1 -1 300 -30 'Choose file :' LOAD filename ''
if $filename > ''
lvuse CedClip.g 1
lvchange $filename
; now save it so as to write it to the clipboard
lvsave 'CLIPS:$cedbar.gc/cedClip'
endif
; --------------------------------------------------------
; Save the current clipboard unit as a file
; --------------------------------------------------------
xIcon 40 5 :icons/save
ReqFile -1 -1 300 -30 'Save as file :' SAVE savename ''
if $savename > ' '
ifexists file $savename
ezreq 'File $savename exists.\nOverwrite ?' Overwrite|CANCEL choice
if $choice = 0
stop
endif
endif
lvsave $savename
endif
; --------------------------------------------------------
; Clear the current clipboard unit
; --------------------------------------------------------
xIcon 70 5 :icons/Clear
lvuse CedClip.g 1
lvclear
; update the clipboard
lvsave 'CLIPS:$cedbar.gc/cedClip'
; --------------------------------------------------------
; Cut
; --------------------------------------------------------
xIcon 110 5 :icons/cut
guiwindow cedclip.g wait
setgad cedclip.g 1 hide ; hide for speed
lvuse cedclip.g 11
lvclear
lvuse cedclip.g 1
lvmulti first
while $$lv.line > ''
lvclip cut 1 add cedclip.g 11
lvmulti next
endwhile
setgad cedclip.g 1 show
lvmulti show
; write it to the clipboard
lvsave 'CLIPS:$cedbar.gc/cedClip'
guiwindow cedclip.g resume
; --------------------------------------------------------
; Copy
; --------------------------------------------------------
; almost same as above..
xIcon 140 5 :icons/copy
guiwindow cedclip.g wait
setgad cedclip.g 1 hide ; hide for speed
lvuse cedclip.g 11
lvclear
lvuse cedclip.g 1
lvmulti first
while $$lv.line > ''
lvclip copy 1 add cedclip.g 11
lvmulti next
endwhile
setgad cedclip.g 1 show
lvmulti show
lvsave 'CLIPS:$cedbar.gc/cedClip'
guiwindow cedclip.g resume
; --------------------------------------------------------
; Paste - Insert records after CURRENT record
; --------------------------------------------------------
xIcon 170 5 :icons/paste
guiwindow cedclip.g wait
lvuse cedclip.g 11
lvgo first
lvclip copy -1 insert cedclip.g 1
lvuse cedclip.g 1
lvsave 'CLIPS:$cedbar.gc/cedClip'
guiwindow cedclip.g resume
; --------------------------------------------------------
; The listviews
; --------------------------------------------------------
XLISTVIEW 1 25 405 164 "" clipline CLIPS:0 10 MULTI
gadid 1
; hiden listview - use it as my clip holder
XLISTVIEW 1 25 405 164 "" lv11 '' 10 MULTI
gadid 11